

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> 
<jsp:include page="/common.jsp" />
<title>阿尔法服装进销存管理系统V1.0</title>
<meta name="keywords" content="服装,进销存" />
<link href="${pageContext.request.contextPath}/resource/login.css"
	rel="stylesheet" type="text/css" />
<style>
.content {
	clear: both;
	background:
		url(${pageContext.request.contextPath}/resource/img/bg_login.jpg)
		no-repeat;
	height: 334px;
	margin-top:100px;
}

.foot {
	clear: both;
	background:
		url(${pageContext.request.contextPath}/resource/img/bg_login_split.gif)
		repeat-x;
	height: 87px;
	margin-top: 80px;
	text-align: center;
	line-height: 87px;
	color: #929191;
}

.zy_foot {
	clear: both;
	background:
		url(${pageContext.request.contextPath}/resource/img/bg_login_split.gif)
		repeat-x;
	height: 87px;
	margin-top: 20px;
	text-align: center;
	color: #929191;
}
</style>
</head>
<body>
	<div id="bigbox">

		<div class="content" >
			<ul>
				<li><span class="user">用户名：</span><span> <input
						name="userName" type="text" id="txtusername" class="userk"
						style="width: 150px" /></span></li>
				<li><span class="user">密 码：</span><span><input
						name="passWord" type="password" id="txtpwd" class="userk"
						style="width: 150px;" /></span></li>
				<li><span class="user">验证码：</span><span><input
						name="code" type="text" id="txtyzm" class="userk"
						style="width: 80px" />&nbsp;&nbsp;&nbsp;</span><img id="valImg"
					src="${pageContext.request.contextPath}/resource/genValImage.htm"
					alt="点击刷新验证码" align="top"/></li>
				
				<li class="dlan"><input type="image" name="ibtn" id="ibtn"
					src="${pageContext.request.contextPath}/resource/img/button_login.gif"
					onclick="return checkdata();" style="border-width: 0px;" /></li>
			</ul>
		</div>

		<div class="foot">
			&copy;2012-
			<script>
				var d = new Date();
				document.write(d.getFullYear());
			</script>

			阿尔法进销存管理  All rights reserved
			联系电话： 0512-88888888 传真： 0512-88888888

		</div>
	</div>
	<script language="javascript" type="text/javascript">
		document.all("userName").focus();
		function checkdata() {
			if ($("#txtusername").val() == "" || $("#txtpwd").val() == "") {
				alert("用户名或密码不为空!");
				return false;
			}
			if ($("#txtyzm").val() == "") {
				alert("验证码不能为空!");
				return false;
			}
			login();
		}

		$(function() {
			$('#valImg').click(
					function() {//生成验证码  
						$(this).hide().attr(
								'src',
								'${pageContext.request.contextPath}/resource/genValImage.htm?'
										+ Math.floor(Math.random() * 100))
								.fadeIn();
					})
		});

		function login() {
			var username = document.all("userName").value;
			var password = document.all("passWord").value;
			var valcode = document.all("code").value;
			var url = "${pageContext.request.contextPath}/system/user/login.htm?userName="
					+ username + "&passWord=" + password + "&code=" + valcode;
			$
					.get(
							url,
							function(response) {
								rst = response;

								switch (rst) {
								case '0':
									$.messager.alert("提示","请输入用户名|口令|验证码","info");
									break;
								case '1':
									window.location.href = "${pageContext.request.contextPath}/security/role/toMain.htm";
									break;
								case '-1':
									$.messager.alert("提示","用户名或密码不匹配[" + username + "]","info");
									break;
								case '-2':
									$.messager.alert("提示","验证码错误[" + valcode + "]","error");
									break;
								default:
									$.messager.alert("提示","未知错误[" + rst + "]","info");
									break;
								}

							});
		}
	</script>
</body>
</html>

